<template>
    <div>
        <van-nav-bar title="首页" left-text="返回" left-arrow @click-left="onClickLeft" />
        <van-search v-model="value" shape="round" background="red" placeholder="请输入搜索关键词" @click="bth" />
        <van-swipe :autoplay="3000" lazy-render>
            <van-swipe-item v-for="image in images" :key="image">
                <img :src="image" style="width: 100%;height: 200px;" />
            </van-swipe-item>
        </van-swipe>
        <van-grid :column-num="4">
            <van-grid-item v-for="item in catitems" :icon="item.image_src" :text="item.name" />
        </van-grid>
        <van-grid :column-num="4">
            <van-grid-item v-for="item in catitems" :icon="item.image_src" :text="item.name" />
        </van-grid>
        <div class="we">
            <span>秒杀专场 10点场 10时 32分 48 秒</span>
            <dl>
                <dt><img src="../../img/1.png" alt=""></dt>
                <dd>￥8659</dd>
            </dl>
            <dl>
                <dt><img src="../../img/1.png" alt=""></dt>
                <dd>￥8659</dd>
            </dl>
            <dl>
                <dt><img src="../../img/1.png" alt=""></dt>
                <dd>￥8659</dd>
            </dl>
        </div>
    </div>
</template>

<script setup>
const images = [
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-1.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-2.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-3.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-4.jpeg',
];
import { ref } from 'vue';
import { catitemsApi } from '@/api/api'
import { useRouter } from 'vue-router';
let router = useRouter()
let catitems = ref([])
catitemsApi().then(res => {
    console.log('导航数据', res);
    catitems.value = res.data.message
})
let bth = () => {
    router.push('/ss')
}
</script>

<style lang="scss" scoped>
.we {
    width: 100%;
    height: 200px;
    border: 1px solid red;
}
dl dt img{
    width: 80px;
    height: 80px;
}
dl{
    float: left;
}
dd{
    color: pink;
}
</style>